<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<HTML>
<HEAD>
	<meta http-equiv="Content-Language" content="zh-cn">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link href="${pageContext.request.contextPath}/admin/css/Style.css"
		rel="stylesheet" type="text/css" />

	<link href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.min.css"
		  rel="stylesheet" type="text/css" />

	<script language="javascript"
		src="${pageContext.request.contextPath}/admin/js/public.js"></script>

	<script language="javascript"
			src="${pageContext.request.contextPath}/admin/jquery/jquery-1.4.2.js"></script>



	<script type="text/javascript">
		function addNotice() {
			window.location.href = "${pageContext.request.contextPath}/admin/notices/add.jsp";
		}
	</script>
</HEAD>
<body>
	<br />
	<form id="Form1" name="Form1" action="" method="post">
		<table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
			<tbody>
				<tr>
					<td class="ta_01" align="center" bgColor="#afd1f3">
					    <strong>公 告 列 表</strong>
					</td>
				</tr>
				<tr>
					<td class="ta_01" align="right">
						<button type="button" id="add" name="add" value="&#28155;&#21152;" class="button_add" onclick="addNotice()">
							&#28155;&#21152;
						</button>
					</td>
				</tr>
				<tr>
					<td class="ta_01" align="center" bgColor="#f5fafe">
						<table cellspacing="0" cellpadding="1" rules="all"
							bordercolor="gray" border="1" id="DataGrid1"
							style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
							<tr
								style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">
								<td align="center" width="12%">公告编号</td>
								<td align="center" width="12%">公告标题</td>
								<td align="center" width="24%">公告内容</td>
								<td align="center" width="8%">时间</td>
								<td width="8%" align="center">编辑</td>
								<td width="8%" align="center">删除</td>
							</tr>
							<c:forEach items="${p.list}" var="n">
								<tr onmouseover="this.style.backgroundColor = 'white'" onmouseout="this.style.backgroundColor = '#F5FAFE';">
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="23">${n.n_id }</td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="18%">${n.title }</td>
									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="8%">${n.details }</td>

									<td style="CURSOR: hand; HEIGHT: 22px" align="center"
										width="8%"> <fmt:formatDate value="${n.n_time }" pattern="yyyy-MM-dd"/> </td>
									<td align="center" style="HEIGHT: 22px" width="7%">
										<a href="${pageContext.request.contextPath}/manage/editUI.do?id=${n.n_id}">
											<img src="${pageContext.request.contextPath}/admin/images/i_edit.gif" border="0" style="CURSOR: hand"> 
										</a>
									</td>
									<td align="center" style="HEIGHT: 22px" width="7%">
										<input type="hidden" value="${n.n_id}"/>
										<p onclick="deleteNotice(this)">
											<img src="${pageContext.request.contextPath}/admin/images/i_del.gif" width="16" height="16" border="0" style="CURSOR: hand">
										</p>
									</td>
								</tr>
							</c:forEach>
						</table>
					</td>
				</tr>

				<tr>
					<td>
					<table width="100%">
					      <tr>
							  <td class="ta_01" align="right">
								  第${p.pageNum}页 /共${p.pages}页 </li>
							  </td>
							  <td class="ta_01">
								  <ul class="pagination">
									  <li>
										  <a href="#">首页</a>
									  </li>
									  <c:forEach begin="1" end="${p.pages}" varStatus="s" var="i">
										  <li>
											  <a href="#">${i}</a>
										  </li>
									  </c:forEach>
									  <li>
										  <a href="#">尾页</a>
									  </li>

									  </li>
								  </ul>
							  </td>
						  </tr>
					</table>
					</td>
				</tr>
			</TBODY>
		</table>
	</form>

<script>
	function deleteNotice(e) {
		var id = $(e).prev("input").attr("value");
		$.ajax({
			url:"/manage/deleteNotice.do",
			type:"POST",
			data:"id="+id,
			dataType:"json",
			success:function (data) {
				alert(data.message);
				if (data.status == 0){
					window.location.href = "/manage/findAll.do";
				}
			}
		})
	}
</script>
</body>
</HTML>